#!/bin/bash

#循环的中控制语句
# - break
# for i in a b c d e f
# do
#     if  [ $i == 'c' ];then
#         #break  #终止循环
#         continue #跳出本次循环
#     fi
#     echo  ${i}
# done


username="root"
password="abc123"
for (( a=2; a >= 0; --a ))
do
    read  -p "输入用户名: " user
    read  -t 30 -s -p "输入密码: " pass
    if  [ $username  == $user  -a $password  == $pass ];then
        echo -e "\n登录系统成功"
        #break
        continue
    else
        echo " "
        echo "登录失败，请检查用户名或者密码是否输入错误"
    fi
    echo  "剩余${a}次"
done